package top.houry.im.client.utils;

import com.aliyun.oss.OSS;
import top.houry.im.client.oss.OSSClient;

/**
 * @Desc
 * @Author houruiyang
 * @Date 2022/6/8
 **/
public class OssUtils {

    private static final OSS ossClient = OSSClient.getInstance();

    public static void uploadImage() {
        ossClient.doesObjectExist("", "");
    }

    //判断文件夹是否存在，不存在则创建
		if(!ossClient.doesObjectExist(bucketName, keySuffixWithSlash)){
        //创建文件夹
        ossClient.putObject(bucketName, keySuffixWithSlash, new ByteArrayInputStream(new byte[0]));

        //得到文件夹名
        OSSObject object = ossClient.getObject(bucketName, keySuffixWithSlash);
        String fileDir=object.getKey();
        return fileDir;
    }

}
